package com.tony.demo.widget;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.tony.demo.R;

public class MyToast extends Toast {

	public MyToast(Context context) {
		super(context);
	}

	public static Toast makeToast(Context context, CharSequence text, int duration) {
		View v = LayoutInflater.from(context).inflate(R.layout.weight_layout_mytoast, null);
		TextView tv = (TextView) v.findViewById(R.id.tv_mytoast_message);
		tv.setText(text);

		MyToast result = new MyToast(context);
		result.setView(v);
		result.setDuration(duration);
		result.setGravity(Gravity.TOP, 0, 100);

		return result;
	}

}
